<%@include file="/WEB-INF/pages/commons/commons.jsp"%>

<c:set var="selectedTab" value="Blogs" scope="request"/>
<fmt:message var="title" key="blog_entries.jsp.title" scope="request"/>
<stripes:layout-render name="${_themePath}/basic-layout-without-navbar.jsp" _title="${title}">

    <stripes:layout-component name="_topNav">
            <H1>Blog Management</H1>
            <UL class="gc-topnav-tabs">
                <LI>&nbsp;</LI>
            </UL>
    </stripes:layout-component>

    <stripes:layout-component name="_content">

        <h2>Entries</h2>

        <fmt:message var="col_blogEntryId" key="blog_entries.jsp.col.blogEntryId"/>
        <fmt:message var="col_blogEntryName" key="blog_entries.jsp.col.blogEntryName"/>
        <fmt:message var="col_blogEntryDescription" key="blog_entries.jsp.col.blogEntryDescription"/>
        <fmt:message var="col_actions" key="blog_entries.jsp.col.actions" />

        <stripes:link beanclass="foo.bar.blog.web.action.registered.BlogsProfileActionBean" event="newBlogEntry">
            <stripes:param name="blog" value="${actionBean.blog.id}" />
            New Entry
        </stripes:link>
        <p/>
        <stripes:url var="blogEntriesUri" beanclass="foo.bar.blog.web.action.registered.BlogsProfileActionBean" event="blogEntries" />
        <displaytag:table id="element" name="actionBean.blogEntries" sort="external"
                          excludedParams="*"
                          defaultsort="1"
                          defaultorder="ascending"
                          requestURI="${blogEntriesUri}"
                          requestURIcontext="true"
                          style="width:100%;">
            <displaytag_el:column property="id" sortable="false" sortName="id" title="${col_blogEntryId}"  />
            <displaytag_el:column property="name" sortable="false" sortName="username" title="${col_blogEntryName}" />
            <displaytag_el:column property="description" sortable="false" sortName="description" title="${col_blogEntryDescription}" />
            <displaytag_el:column title="${col_actions}">
                <jsecurity:hasPermission name="blog:viewBlogEntries:${element.blog.id}">
                <stripes:link beanclass="foo.bar.blog.web.action.registered.BlogsProfileActionBean" event="viewBlogEntry">
                    <stripes:param name="blogEntry" value="${element.id}"/>
                    <stripes:param name="blog" value="${element.blog.id}"/>
                    <fmt:message key="blog_entries.jsp.viewBlogEntry"/>
                </stripes:link>
                </jsecurity:hasPermission>
                <jsecurity:hasPermission name="blog:editBlogEntry:${element.blog.id}">
                |&nbsp;<stripes:link beanclass="foo.bar.blog.web.action.registered.BlogsProfileActionBean" event="editBlogEntry">
                    <stripes:param name="blogEntry" value="${element.id}"/>
                    <stripes:param name="blog" value="${element.blog.id}"/>
                    <fmt:message key="blog_entries.jsp.editBlogEntry"/>
                </stripes:link>
                </jsecurity:hasPermission>
                <jsecurity:hasPermission name="blog:deleteBlogEntry:${element.blog.id}">
                |&nbsp;<stripes:link beanclass="foo.bar.blog.web.action.registered.BlogsProfileActionBean" event="deleteBlogEntry">
                    <stripes:param name="blogEntry" value="${element.id}"/>
                    <stripes:param name="blog" value="${element.blog.id}"/>
                    <fmt:message key="blog_entries.jsp.removeBlogEntry"/>
                </stripes:link>
                </jsecurity:hasPermission>
                <jsecurity:hasPermission name="blog:viewBlogEntryComments:${element.blog.id}">
                |&nbsp;<stripes:link beanclass="foo.bar.blog.web.action.registered.BlogsProfileActionBean" event="viewBlogEntryComments">
                    <stripes:param name="blogEntry" value="${element.id}"/>
                    <fmt:message key="blog_entries.jsp.viewBlogEntryComments"/>
                </stripes:link>
                </jsecurity:hasPermission>
                <jsecurity:hasPermission name="blog:viewResources:${element.blog.id}">
                |&nbsp;<stripes:link beanclass="foo.bar.blog.web.action.registered.BlogsProfileActionBean" event="resources">
                    <stripes:param name="blogEntry" value="${element.id}"/>
                    <fmt:message key="blogs.jsp.action.viewResources"/>
                </stripes:link>
                </jsecurity:hasPermission>
            </displaytag_el:column>
        </displaytag:table>

    </stripes:layout-component>
</stripes:layout-render>

